home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / archiver / redate2.zip / ARCHDR.H next >
C/C++ Source or Header  |  1991-05-13  |  16KB  |  406 lines

  1. #ifndef fallthrough        /* "fallthrough" is in opus.h */
  2. typedef unsigned    char    byte;
  3. typedef unsigned    int     word;
  4. #endif
  5.  
  6.  
  7. /****** General purpose Symbolic constants:  *********/
  8. #define TRUE    1        /* general purpose true truth value */
  9. #define FALSE    0        /* general purpose false truth value */
  10. #define ERROR    -1        /* General "on error" return value */
  11. #define OK    0        /* General "no error" return value */
  12. #define EOS    '\0'        /* standard end of string */
  13.  
  14. #define MAX_PATH    78        /* max. length of full pathname        */
  15. #define MAX_DIR     66        /* max. length of full directory name    */
  16.  
  17. #define FOSSIL      0x0001        /* running remotely */
  18. #define MORE        0x0002        /* User wants More? prompts */
  19. #define WANTS_MORE  0x0004        /* User has more in User.BBS */
  20. #define VIEW        0x0008        /* View text files inside archive */
  21. #define    WATCH        0x0010        /* Use FOSSIL watchdog */
  22.  
  23. #define ARC         0x1000        /* ARC/PAK file */
  24. #define ZIP         0x2000        /* PKZIP file */
  25. #define ZOO         0x4000        /* ZOO File */
  26. #define DWC         0x8000        /* DWC File */
  27. #define ARJ         0x0200        /* ARJ File */
  28. /*----------------------------------------------------------------------*/
  29. /*         Information for file date conversion            */
  30. /*----------------------------------------------------------------------*/
  31. #define MONTH_SHIFT     5
  32. #define MONTH_MASK      0x0F
  33. #define DAY_MASK    0x1F
  34. #define YEAR_SHIFT      9
  35. #define DOS_EPOCH       80
  36. #define HOUR_SHIFT      11
  37. #define HOUR_MASK       0x1F
  38. #define MINUTE_SHIFT    5
  39. #define MINUTE_MASK     0x3F
  40.  
  41.  
  42. /*----------------------------------------------------------------------*/
  43. /*              archive list junk                */
  44. /*----------------------------------------------------------------------*/
  45. #define ARCMARK 26    /* special archive marker */
  46. #define ARCVER 10    /* highest compression code used */
  47.  
  48. #pragma pack(1)        /* req'd by MSC to keep struct byte aligned */ 
  49. struct heads        /* archive entry header format */
  50. {   
  51.     char mbrname[13];    /* file name */
  52.     long mbrsize;    /* size of file in archive, bytes */
  53.     unsigned mbrdate;    /* creation date */
  54.     unsigned mbrtime;    /* creation time */
  55.     int mbrcrc;        /* cyclic redundancy check */
  56.     long mbrlen;    /* true file size, bytes */
  57. };
  58. #pragma pack()        /* we now return to our regular programming */
  59.  
  60.  
  61. /*--------------------------------------------------------------------------*/
  62. /* Garbage for ZOO listing                                                  */
  63. /*--------------------------------------------------------------------------*/
  64.  
  65. #define MAJOR_VER 1        /* needed to manipulate archive */
  66. #define MINOR_VER 4
  67.  
  68. #define MAJOR_EXT_VER 1    /* needed to extract file */
  69. #define MINOR_EXT_VER 0
  70.  
  71. #define CTRL_Z 26
  72. #define ZOO_TAG ((unsigned long) 0xFDC4A7DC) /* A random choice */
  73. #define TEXT "ZOO 1.50 Archive.\032"   /* Header text for archive. */
  74. #define SIZ_TEXT  20                   /* Size of header text */
  75.  
  76. #define PATHSIZE 256                   /* Max length of pathname */
  77. #define FNAMESIZE 13                   /* Size of DOS filename */
  78. #define LFNAMESIZE 256                 /* Size of long filename */
  79. #define ROOTSIZE 8                     /* Size of fname without extension */
  80. #define EXTLEN 3                       /* Size of extension */
  81. #define FILE_LEADER  "@)#("            /* Allowing location of file data */
  82. #define SIZ_FLDR  5                    /* 4 chars plus null */
  83. #define MAX_PACK 1                     /* max packing method we can handle */
  84. #define BACKUP_EXT ".bak"              /* extension of backup file */
  85.  
  86. #ifdef OOZ
  87. #define FIRST_ARG 2
  88. #endif
  89.  
  90. #ifdef ZOO
  91. #define FIRST_ARG 3        /* argument position of filename list */
  92. #endif
  93.  
  94. /* WARNING:  Static initialization in zooadd.c or zooext.c depends on the 
  95.    order of fields in struct zoo_header */
  96. struct zoo_header {
  97.    char text[SIZ_TEXT];       /* archive header text */
  98.    unsigned long zoo_tag;     /* identifies archives           */
  99.    long zoo_start;            /* where the archive's data starts        */
  100.    long zoo_minus;      /* for consistency checking of zoo_start  */
  101.    char major_ver;
  102.    char minor_ver;            /* minimum version to extract all files   */
  103. };
  104.  
  105. /* Note:  Microsoft C aligns data at word boundaries.  So, to keep things
  106.    compact, always try to pair up character fields. */
  107. struct direntry {
  108.    unsigned long zoo_tag;     /* tag -- redundancy check */
  109.    char type;                 /* type of directory entry.  always 1 for now */
  110.    char packing_method;       /* 0 = no packing, 1 = normal LZW */
  111.    long next;                 /* pos'n of next directory entry */
  112.    long offset;               /* position of this file */
  113.    unsigned int date;         /* DOS format date */
  114.    unsigned int time;         /* DOS format time */
  115.    unsigned int file_crc;     /* CRC of this file */
  116.    long org_size;
  117.    long size_now;
  118.    char major_ver;
  119.    char minor_ver;            /* minimum version needed to extract */
  120.    char deleted;              /* will be 1 if deleted, 0 if not */
  121.    char struc;                /* file structure if any */
  122.    long comment;              /* points to comment;  zero if none */
  123.    unsigned int cmt_size; /* length of comment, 0 if none */
  124.    char fname[FNAMESIZE]; /* filename */
  125.  
  126.    int var_dir_len;           /* length of variable part of dir entry */
  127.    char tz;                   /* timezone where file was archived */
  128.    unsigned int dir_crc;      /* CRC of directory entry */
  129.  
  130.    /* fields for variable part of directory entry follow */
  131.    char namlen;               /* length of long filename */
  132.    char dirlen;               /* length of directory name */
  133.    char lfname[LFNAMESIZE];   /* long filename */
  134.    char dirname[PATHSIZE];    /* directory name */
  135.    int system_id;             /* Filesystem ID */
  136. };
  137.  
  138. /* Values for direntry.system_id */
  139. #define SYSID_NIX       0     /* UNIX and similar filesystems */
  140. #define SYSID_MS        1     /* MS-DOS filesystem */
  141. #define SYSID_PORTABLE  2     /* Portable syntax */
  142.  
  143. /*-End of Zoo stuff---------------------------------------------------------*/
  144. /*-Start of DWC stuff-------------------------------------------------------*/
  145. #pragma pack(1)        /* req'd by MSC to keep struct byte aligned    */ 
  146.  
  147. /* ENTRY - information that is stored for each file in the DWC archive.      */
  148.  
  149. struct dwc_entry {
  150.    char     name[13];      /* ... File name, Note: path is not saved here    */
  151.    long     size;          /* ... Size of file before compression in bytes   */
  152.    long     time;          /* ... Time stamp on file before added to archive */
  153.    long     new_size;      /* ... Size of compressed file                    */
  154.    long     pos;           /* ... Position of file in archive file           */
  155.    char     method;        /* ... Method of compression used on file         */
  156.    char     sz_c;          /* ... Size of comment added to file              */
  157.    char     sz_d;          /* ... Size of directory name recorded on add     */
  158.    unsigned crc;           /* ... CRC value computed for this file           */
  159. };
  160.  
  161. /* ARCHIVE - information that is stored at the end of every achive.          */
  162.  
  163. struct dwc_arc {
  164.    unsigned size;          /* ... Size of archive structure, future expansion*/
  165.    char     ent_sz;        /* ... Size of directory entry, future expansion  */
  166.    char     header[13];    /* ... Name of Header file to print on listings   */
  167.    long     time;          /* ... Time stamp of last modification to archive */
  168.    long     entries;       /* ... Number of entries in archive               */
  169.    char     id[3];         /* ... the string "DWC" to identify archive       */
  170. };
  171. #pragma pack()
  172. /*-End of DWC stuff---------------------------------------------------------*/
  173.  
  174. /*--------------------------------------------------------------------------*/
  175. /* PKZIP (Phil Katz)                                                        */
  176. /*--------------------------------------------------------------------------*/
  177.  
  178. struct ID_Hdr {
  179.     word    PK_ID;        /* Always = PK = 0x4B50  */
  180.     word    Head_Type;        /* Identifil